<!--
 * @Description  :
 * @Autor        : guoxi
 * @Date         : 2022-06-29 14:08:57
 * @LastEditors  : Please set LastEditors
 * @LastEditTime : 2022-09-07 16:38:12
 * @FilePath     : \rpms\src\views\document\scientific\index.vue
-->
<template>
  <el-card>
    <div class="tab-header">
      <div class="export-box">
        <el-select v-model="model.companyEntityMaxCode" @change="change">
          <el-option label="华润啤酒" value="" />
          <el-option label="华润雪花" value="2" />
          <el-option label="华润酒业" value="3" />
        </el-select>
        <el-button
          v-auth="`document-scientific-export`"
          style="margin-left: 20px"
          type="primary"
          @click="exportExcel"
          >导出</el-button
        >
      </div>

      <el-tabs v-model="model.activeName" :lazy="true">
        <el-tab-pane label="专利" name="1">
          <patent-list :companyEntityMaxCode="model.companyEntityMaxCode" :approvalList="approvalList"/>
        </el-tab-pane>
        <el-tab-pane label="软件著作权" name="2">
          <software-list :companyEntityMaxCode="model.companyEntityMaxCode" :approvalList="approvalList" />
        </el-tab-pane>
        <el-tab-pane label="论文" name="3">
          <paper-list :companyEntityMaxCode="model.companyEntityMaxCode" :approvalList="approvalList" />
        </el-tab-pane>
        <el-tab-pane label="专著" name="4">
          <book-list :companyEntityMaxCode="model.companyEntityMaxCode" :approvalList="approvalList" />
        </el-tab-pane>
        <el-tab-pane label="标准" name="5">
          <standard-list :companyEntityMaxCode="model.companyEntityMaxCode" :approvalList="approvalList" />
        </el-tab-pane>
        <el-tab-pane label="科技奖励" name="6">
          <award-list :companyEntityMaxCode="model.companyEntityMaxCode" :approvalList="approvalList" />
        </el-tab-pane>

        <el-tab-pane label="其他" name="7">
          <other-list :companyEntityMaxCode="model.companyEntityMaxCode" :approvalList="approvalList" />
        </el-tab-pane>
      </el-tabs>
    </div>
  </el-card>
</template>

<script lang="ts" setup>
import PatentList from "./patent/list.vue";
import PaperList from "./paper/list.vue";
import BookList from "./book/list.vue";
import StandardList from "./standard/list.vue";
import AwardList from "./award/list.vue";
import SoftwareList from "./software/list.vue";
import OtherList from "./other/list.vue";
import { reactive,ref } from "vue";
import { useRouter, useRoute } from "vue-router";
import { emitter } from "/@/utils/mitt";
import { postDictList } from "/@/api/common";
const router = useRouter();
const route = useRoute();
const approvalList = ref([])
const model = reactive({
  companyEntityMaxCode: "",
  activeName: "1"
});

const activeName = route.query.activeName as string;
if (activeName) {
  model.activeName = activeName;
}

const exportExcel = () => {
  router.push("/document/scientific/export");
};

const initScientificDictList = async () => {
  try {
    const params = {
      dicType: "rd_sci_app_status"
    };
    const { code, data } = await postDictList(params);
    if (code === 200) {
      approvalList.value = data
    }
  } catch (err) {
    console.log(err);
  }
};

const change = item => {
  model.companyEntityMaxCode = item;
  emitter.emit("changeCompany", item);
};

initScientificDictList()
</script>

<style lang="scss" scoped>
.tab-header {
  position: relative;

  .export-box {
    position: absolute;
    right: 0;
    z-index: 999;
  }
}
</style>
